<?php
namespace Modules\Product\Http\Controllers\Client\V1;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

use Modules\Product\Entities\Product;

use Modules\Category\Entities\Category;

use Validator;
use ThrowException;
use DB;

class CategoryController extends Controller
{
    public function recommendIndex(Request $req)
    {
        $rule = [
        ];
        Validator::make($req->all(), $rule)->fails() && ThrowException::BadRequest(); 

        $options = $req->all();

        $options['where'] = [
            'level' => 2
        ];

        $options['scopes'] = ['listed'];

        $options['per_page'] = 10;

        $options['only'] = [
            'id',
            'uuid',
            'title',
            'thumb',
        ];

        $list = Category::getList($options);

        return $list->generateListResponse();
    }

}
